<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-menu default-active='active' mode='horizontal' class='menu-unit'>
          <el-menu-item v-for='item in Container2' :index="'基本信息'===item.name?'active':'default'">
            <el-link @click="gotoMenu(item.url)" :type="'基本信息'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
        <table cellpadding="4" cellspacing="0" border="0" width="100%">
          <tr>
            <td class="containerBack">
              <el-form ref="form" :model="person_info" :rules="rules" label-width="100px" id="mvcfm">
                <el-button @click="gotoPage('/crm/sale/CustomerContactsUp?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
                <el-button @click="gotoPage('/crm/sale/CustomerContacts?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 添加联系人 </span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="联系人类型" prop="contact_oneorclient">
                        {{person_info.contact_oneorclient}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="所属部门" prop="person_dept">
                        {{person_info.person_dept}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="岗位" prop="person_station">
                        {{person_info.person_station}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="性别" prop="person_sex">
                        {{person_info.person_sex}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="姓名" prop="person_name">
                        {{person_info.person_name}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="英文名" prop="english_name">
                        {{person_info.english_name}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="附加名称" prop="nick_name">
                        {{person_info.nick_name}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="出生日期" prop="person_birthday">
                        {{person_info.person_birthday}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
                <div class="form-unit">
                  <span class="mvc-title-left"> 电话号码 </span>
                </div>
                <el-table :data="phones">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="u_phones('&phones_id='+scope.row.phones_id+'')">设为主要</el-link>
                          </el-dropdown-item>
                          <el-dropdown-item>
                            <el-link @click="d_phone('&phones_id='+scope.row.phones_id+'')">删除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="类型" prop="description">
                  </el-table-column>
                  <el-table-column label="区号" prop="phone_area">
                  </el-table-column>
                  <el-table-column label="号码" prop="p_no">
                  </el-table-column>
                  <el-table-column label="分机号码" prop="phones_extension">
                  </el-table-column>
                </el-table>
                <el-button @click="popCustomerContactsPAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加电话号码</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 电子邮件地址 </span>
                </div>
                <el-table :data="email">
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="u_email('&email_id='+scope.row.email_id+'')">设为主要</el-link>
                          </el-dropdown-item>
                          <el-dropdown-item>
                            <el-link @click="d_email('&email_id='+scope.row.email_id+'')">删除</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="类型" prop="description">
                  </el-table-column>
                  <el-table-column label="邮件地址" prop="e_address">
                  </el-table-column>
                </el-table>
                <el-button @click="popCustomerContactsEAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加电子邮件</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 即时通讯地址 </span>
                </div>
                <el-table :data="moment_info">
                  <el-table-column label="类型" prop="mccon">
                  </el-table-column>
                  <el-table-column label="信息" prop="mcno">
                  </el-table-column>
                  <el-table-column label="号码" prop="mc_no">
                  </el-table-column>
                </el-table>
                <el-button @click="popCustomerContactsImmAdd('')" type='success' size="mini"><i class='fa fa-plus'></i>增加即时通讯地址</el-button>
                <div class="form-unit">
                  <span class="mvc-title-left"> 地址 </span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="类型" prop="">
                        {{address.address_type}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="地区" prop="">
                        {{address.address_nation}} 省 {{address.address_province}} 城市 {{address.address_city}} 县 {{address.address_town}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="邮政编码" prop="">
                        {{address.address_postcode}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="详细地址" prop="">
                        <div style="white-space: pre-wrap;">{{address.address_info}}</div>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
                <div>
                </div>
                <div class="form-unit">
                  <span class="mvc-title-left"> 额外明细 </span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="备注" prop="">
                        {{person_info.remark}}
                      </el-form-item>
                    </el-col>
                  </el-row>
                </div>
                <el-button @click="gotoPage('/crm/sale/CustomerContactsUp?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
                <el-button @click="gotoPage('/crm/sale/CustomerContacts?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
              </el-form>
            </td>
          </tr>
        </table>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'联系人'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="CustomerContactsPAddVisible" append-to-body>
      <CustomerContactsPAdd v-if="CustomerContactsPAddVisible" ref="CustomerContactsPAdd" :popparams="popparams"> </CustomerContactsPAdd>
    </el-dialog>
    <el-dialog :visible.sync="CustomerContactsEAddVisible" append-to-body>
      <CustomerContactsEAdd v-if="CustomerContactsEAddVisible" ref="CustomerContactsEAdd" :popparams="popparams"> </CustomerContactsEAdd>
    </el-dialog>
    <el-dialog :visible.sync="CustomerContactsImmAddVisible" append-to-body>
      <CustomerContactsImmAdd v-if="CustomerContactsImmAddVisible" ref="CustomerContactsImmAdd" :popparams="popparams"> </CustomerContactsImmAdd>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import CustomerContactsPAdd from "@/views/crm/sale/CustomerContactsPAdd";
  import CustomerContactsEAdd from "@/views/crm/sale/CustomerContactsEAdd";
  import CustomerContactsImmAdd from "@/views/crm/sale/CustomerContactsImmAdd";
  export default {
    name: 'CustomerContactsDet',
    components: {
      CustomerContactsPAdd,
      CustomerContactsEAdd,
      CustomerContactsImmAdd,
    },
    props: ['popparams'],
    data() {
      return {
        CustomerContactsPAddVisible: false,
        CustomerContactsPAddValue: null,
        CustomerContactsPAddDesc: null,
        CustomerContactsEAddVisible: false,
        CustomerContactsEAddValue: null,
        CustomerContactsEAddDesc: null,
        CustomerContactsImmAddVisible: false,
        CustomerContactsImmAddValue: null,
        CustomerContactsImmAddDesc: null,
        vueparams: this.getVUEParams("&CMODULEID=client_message"),
        person_info: {
          contact_oneorclient: null,
          person_dept: null,
          person_station: null,
          person_sex: null,
          person_name: null,
          english_name: null,
          nick_name: null,
          person_birthday: null,
        },
        phones: [],
        email: [],
        moment_info: [],
        address: {
          address_type: null,
          address_nation: null,
          address_province: null,
          address_city: null,
          address_town: null,
          address_postcode: null,
          address_info: null,
          remark: null,
        },
        loading: false,
        Container: null,
        Container2: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "联系人"
      }, 'Container', this.vueparams);
      this.loadContainerMenu({
        pid: "14ED91704E794C43A973E8BEFF724C15",
        name: "客户联系人右菜单",
        selected: "基本信息"
      }, 'Container2', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/CustomerContacts/customerContactsDet?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popCustomerContactsPAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.CustomerContactsPAddVisible = !this.CustomerContactsPAddVisible;
      },
      popCustomerContactsEAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.CustomerContactsEAddVisible = !this.CustomerContactsEAddVisible;
      },
      popCustomerContactsImmAdd(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.CustomerContactsImmAddVisible = !this.CustomerContactsImmAddVisible;
      },
    },
  }
</script>
